import java.util.Scanner;
public class homework1 {
    public static int fun(int a,int n){
       if(n==1){
           return 1;
       }
       else{
           return fun(a,n-1)*a;
       }
    }
    public static void main(final String[] args) 
    { //输出
       System.out.println("Hello,Java!");
        //求和
       final Scanner sc=new Scanner(System.in);
       System.out.println("请输入float类型的数字：");
       final float input=sc.nextFloat();

       final Scanner sc1=  Scanner(System.in);
       System.out.println("请输入double类型的数字：");
       final double input1=sc1.nextDouble();

       final float i=(float)(input+input1);
       System.out.println("和="+String.format("%.2f", i));

       //计算阶乘
       System.out.println("请输入一个1-10之间的整数");
        final int a = sc.nextInt();
		if(a> 10 || a < 1){
			System.out.println("输入有误！");
			}
		else{
			int m=a;
			for(int s = m-1 ;s >= 1;s--){
				m = m * s;
				}
			System.out.println(m);
            }
            //计算n次方
            final Scanner n=new Scanner(System.in);
            System.out.println("请输入int类型的数字：");
            final int nn=n.nextInt();
            int ff=fun(a,nn);
            System.out.println("n次方为："+ff);

        weight();

        n.close();
        sc.close();
        sc1.close();
       
    }
    //体重指数计算器
    public static void weight() {
        final Scanner sc3=new Scanner(System.in);
        System.out.println("请以米为单位输入你的身高");
        final float input3=sc3.nextFloat();
        final Scanner sc4=new Scanner(System.in);
        System.out.println("请以kg为单位输入你的体重");
        final float input4=sc4.nextFloat();
        final float result=input4/(input3*input3);
        System.out.println("您的体重指数是："+result);
        sc3.close();
        sc4.close();
        }
        
}
